package cn.shuangbofu.guice.test;

import com.google.inject.Guice;
import com.google.inject.Injector;

/**
 * Created by shuangbofu on 2020-04-17 14:40
 *
 * @author shuangbofu
 */
public class Injectors {

    private static Injector injector;

    static {
        /*
         * Guice.createInjector() takes one or more modules, and returns a new Injector
         * instance. Most applications will call this method exactly once, in their
         * main() method.
         */
        injector = Guice.createInjector(new GuiceDemo.DemoModule());
    }

    public static <T> T getInstance(Class<T> var1) {
        return injector.getInstance(var1);
    }
}
